#!/usr/local/bin/python

import os
import sys
import string

from Bio import Entrez
from Bio import SeqIO

Entrez.email = "jimmysaw@gmail.com"

f = open(sys.argv[1], "r")

count = 0

while True:
  line = f.readline()
  if len(line) == 0:
    print "empty"
    break
  else:
    ls = line.split('\t') 
    handle = Entrez.efetch(db="protein", id=ls[9], rettype="fasta")
    seq = SeqIO.read(handle, "fasta")
    #qlength = ls[6]
    #hlength = ls[10]
    count += 1
    print len(seq)

print "Total count: ", "\t",count, "\n"

f.close()

